<template>
  <div class="app-pagination">
    <el-pagination
      background
      layout="prev, pager, next"
      :total="paginationMeta.total"
      @current-change="getNextList"
      :page-size="parseInt(paginationMeta.per_page)"
      :current-page.sync="paginationMeta.current_page"
    >
    </el-pagination>
  </div>
</template>
<script>
export default {
  name: "paginAtion",
  props: {
    paginationMeta: {
      type: Object
    }
  },
  data() {
    return {
      per_page: 3
    }
  },
  methods: {
    getNextList(currentPage) {
      this.paginationMeta.current_page = currentPage
      this.$emit('getNextPageList', currentPage)
    }
  },
  watch: {
    paginationMeta: {
      handler(newValue, oldValue) {
        this.paginationMeta = newValue
      },
      deep: true
    }
  }
}
</script>
<style  scoped>
.app-pagination {
  width: 100%;
  line-height: 50px;
  text-align: center;
  padding: 15px 0;
}
</style>